package o;

import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Parcelable;
import android.util.SparseArray;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.KeyCharacterMap.KeyData;
import android.view.KeyEvent;
import android.view.MenuItem;
import android.view.SubMenu;
import android.view.View;
import android.view.ViewConfiguration;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import androidx.annotation.RestrictTo.d;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

@RestrictTo({d.LIBRARY_GROUP})
public class bd implements gi {
    private static final int[] ˎ = new int[]{1, 4, 5, 3, 2, 0};
    private boolean ʻ;
    private boolean ʻॱ = false;
    private ArrayList<bj> ʼ;
    private boolean ʼॱ = false;
    private final Resources ʽ;
    private CopyOnWriteArrayList<WeakReference<bn>> ʽॱ = new CopyOnWriteArrayList();
    private ArrayList<bj> ʾ = new ArrayList();
    private boolean ʿ = false;
    private bj ˈ;
    private boolean ˉ = false;
    Drawable ˊ;
    private boolean ˊˊ;
    private ArrayList<bj> ˊॱ;
    private final Context ˋ;
    private boolean ˋॱ;
    View ˏ;
    private ArrayList<bj> ˏॱ;
    private ArrayList<bj> ͺ;
    CharSequence ॱ;
    private boolean ॱˊ;
    private boolean ॱˋ = false;
    private boolean ॱˎ = false;
    private boolean ॱॱ;
    private ContextMenuInfo ॱᐝ;
    private e ᐝ;
    private int ᐝॱ = 0;

    @RestrictTo({d.LIBRARY_GROUP})
    public interface e {
        void ˎ(bd bdVar);

        boolean ॱ(bd bdVar, MenuItem menuItem);
    }

    @RestrictTo({d.LIBRARY_GROUP})
    public interface a {
        boolean ॱ(bj bjVar);
    }

    public bd(Context context) {
        this.ˋ = context;
        this.ʽ = context.getResources();
        this.ʼ = new ArrayList();
        this.ˊॱ = new ArrayList();
        this.ˋॱ = true;
        this.ˏॱ = new ArrayList();
        this.ͺ = new ArrayList();
        this.ॱˊ = true;
        ˋ(true);
    }

    public bd ॱ(int i) {
        this.ᐝॱ = i;
        return this;
    }

    public void ˊ(bn bnVar) {
        ˏ(bnVar, this.ˋ);
    }

    public void ˏ(bn bnVar, Context context) {
        this.ʽॱ.add(new WeakReference(bnVar));
        bnVar.ˏ(context, this);
        this.ॱˊ = true;
    }

    public void ˏ(bn bnVar) {
        Iterator it = this.ʽॱ.iterator();
        while (it.hasNext()) {
            WeakReference weakReference = (WeakReference) it.next();
            bn bnVar2 = (bn) weakReference.get();
            if (bnVar2 == null || bnVar2 == bnVar) {
                this.ʽॱ.remove(weakReference);
            }
        }
    }

    private void ॱ(boolean z) {
        if (!this.ʽॱ.isEmpty()) {
            ॱॱ();
            Iterator it = this.ʽॱ.iterator();
            while (it.hasNext()) {
                WeakReference weakReference = (WeakReference) it.next();
                bn bnVar = (bn) weakReference.get();
                if (bnVar == null) {
                    this.ʽॱ.remove(weakReference);
                } else {
                    bnVar.ˊ(z);
                }
            }
            ʼ();
        }
    }

    private boolean ˎ(bv bvVar, bn bnVar) {
        boolean z = false;
        if (this.ʽॱ.isEmpty()) {
            return false;
        }
        if (bnVar != null) {
            z = bnVar.ˎ(bvVar);
        }
        Iterator it = this.ʽॱ.iterator();
        boolean z2 = z;
        while (it.hasNext()) {
            WeakReference weakReference = (WeakReference) it.next();
            bn bnVar2 = (bn) weakReference.get();
            if (bnVar2 == null) {
                this.ʽॱ.remove(weakReference);
                z = z2;
            } else if (z2) {
                z = z2;
            } else {
                z = bnVar2.ˎ(bvVar);
            }
            z2 = z;
        }
        return z2;
    }

    private void ॱ(Bundle bundle) {
        if (!this.ʽॱ.isEmpty()) {
            SparseArray sparseArray = new SparseArray();
            Iterator it = this.ʽॱ.iterator();
            while (it.hasNext()) {
                WeakReference weakReference = (WeakReference) it.next();
                bn bnVar = (bn) weakReference.get();
                if (bnVar == null) {
                    this.ʽॱ.remove(weakReference);
                } else {
                    int ॱ = bnVar.ॱ();
                    if (ॱ > 0) {
                        Parcelable ʽ = bnVar.ʽ();
                        if (ʽ != null) {
                            sparseArray.put(ॱ, ʽ);
                        }
                    }
                }
            }
            bundle.putSparseParcelableArray("android:menu:presenters", sparseArray);
        }
    }

    private void ॱॱ(Bundle bundle) {
        SparseArray sparseParcelableArray = bundle.getSparseParcelableArray("android:menu:presenters");
        if (sparseParcelableArray != null && !this.ʽॱ.isEmpty()) {
            Iterator it = this.ʽॱ.iterator();
            while (it.hasNext()) {
                WeakReference weakReference = (WeakReference) it.next();
                bn bnVar = (bn) weakReference.get();
                if (bnVar == null) {
                    this.ʽॱ.remove(weakReference);
                } else {
                    int ॱ = bnVar.ॱ();
                    if (ॱ > 0) {
                        Parcelable parcelable = (Parcelable) sparseParcelableArray.get(ॱ);
                        if (parcelable != null) {
                            bnVar.ˏ(parcelable);
                        }
                    }
                }
            }
        }
    }

    public void ˏ(Bundle bundle) {
        ॱ(bundle);
    }

    public void ˋ(Bundle bundle) {
        ॱॱ(bundle);
    }

    public void ˎ(Bundle bundle) {
        int size = size();
        int i = 0;
        SparseArray sparseArray = null;
        while (i < size) {
            MenuItem item = getItem(i);
            View actionView = item.getActionView();
            if (!(actionView == null || actionView.getId() == -1)) {
                if (sparseArray == null) {
                    sparseArray = new SparseArray();
                }
                actionView.saveHierarchyState(sparseArray);
                if (item.isActionViewExpanded()) {
                    bundle.putInt("android:menu:expandedactionview", item.getItemId());
                }
            }
            SparseArray sparseArray2 = sparseArray;
            if (item.hasSubMenu()) {
                ((bv) item.getSubMenu()).ˎ(bundle);
            }
            i++;
            sparseArray = sparseArray2;
        }
        if (sparseArray != null) {
            bundle.putSparseParcelableArray(ˊ(), sparseArray);
        }
    }

    public void ˊ(Bundle bundle) {
        if (bundle != null) {
            MenuItem item;
            SparseArray sparseParcelableArray = bundle.getSparseParcelableArray(ˊ());
            int size = size();
            for (int i = 0; i < size; i++) {
                item = getItem(i);
                View actionView = item.getActionView();
                if (!(actionView == null || actionView.getId() == -1)) {
                    actionView.restoreHierarchyState(sparseParcelableArray);
                }
                if (item.hasSubMenu()) {
                    ((bv) item.getSubMenu()).ˊ(bundle);
                }
            }
            int i2 = bundle.getInt("android:menu:expandedactionview");
            if (i2 > 0) {
                item = findItem(i2);
                if (item != null) {
                    item.expandActionView();
                }
            }
        }
    }

    protected String ˊ() {
        return "android:menu:actionviewstates";
    }

    public void ॱ(e eVar) {
        this.ᐝ = eVar;
    }

    protected MenuItem ˏ(int i, int i2, int i3, CharSequence charSequence) {
        int ᐝ = ᐝ(i3);
        MenuItem ˎ = ˎ(i, i2, i3, ᐝ, charSequence, this.ᐝॱ);
        if (this.ॱᐝ != null) {
            ˎ.ˋ(this.ॱᐝ);
        }
        this.ʼ.add(ॱ(this.ʼ, ᐝ), ˎ);
        ˎ(true);
        return ˎ;
    }

    private bj ˎ(int i, int i2, int i3, int i4, CharSequence charSequence, int i5) {
        return new bj(this, i, i2, i3, i4, charSequence, i5);
    }

    public MenuItem add(CharSequence charSequence) {
        return ˏ(0, 0, 0, charSequence);
    }

    public MenuItem add(int i) {
        return ˏ(0, 0, 0, this.ʽ.getString(i));
    }

    public MenuItem add(int i, int i2, int i3, CharSequence charSequence) {
        return ˏ(i, i2, i3, charSequence);
    }

    public MenuItem add(int i, int i2, int i3, int i4) {
        return ˏ(i, i2, i3, this.ʽ.getString(i4));
    }

    public SubMenu addSubMenu(CharSequence charSequence) {
        return addSubMenu(0, 0, 0, charSequence);
    }

    public SubMenu addSubMenu(int i) {
        return addSubMenu(0, 0, 0, this.ʽ.getString(i));
    }

    public SubMenu addSubMenu(int i, int i2, int i3, CharSequence charSequence) {
        bj bjVar = (bj) ˏ(i, i2, i3, charSequence);
        bv bvVar = new bv(this.ˋ, this, bjVar);
        bjVar.ˊ(bvVar);
        return bvVar;
    }

    public SubMenu addSubMenu(int i, int i2, int i3, int i4) {
        return addSubMenu(i, i2, i3, this.ʽ.getString(i4));
    }

    public void setGroupDividerEnabled(boolean z) {
        this.ˉ = z;
    }

    public boolean ॱ() {
        return this.ˉ;
    }

    public int addIntentOptions(int i, int i2, int i3, ComponentName componentName, Intent[] intentArr, Intent intent, int i4, MenuItem[] menuItemArr) {
        PackageManager packageManager = this.ˋ.getPackageManager();
        List queryIntentActivityOptions = packageManager.queryIntentActivityOptions(componentName, intentArr, intent, 0);
        int size = queryIntentActivityOptions != null ? queryIntentActivityOptions.size() : 0;
        if ((i4 & 1) == 0) {
            removeGroup(i);
        }
        for (int i5 = 0; i5 < size; i5++) {
            Intent intent2;
            ResolveInfo resolveInfo = (ResolveInfo) queryIntentActivityOptions.get(i5);
            if (resolveInfo.specificIndex < 0) {
                intent2 = intent;
            } else {
                intent2 = intentArr[resolveInfo.specificIndex];
            }
            Intent intent3 = new Intent(intent2);
            intent3.setComponent(new ComponentName(resolveInfo.activityInfo.applicationInfo.packageName, resolveInfo.activityInfo.name));
            MenuItem intent4 = add(i, i2, i3, resolveInfo.loadLabel(packageManager)).setIcon(resolveInfo.loadIcon(packageManager)).setIntent(intent3);
            if (menuItemArr != null && resolveInfo.specificIndex >= 0) {
                menuItemArr[resolveInfo.specificIndex] = intent4;
            }
        }
        return size;
    }

    public void removeItem(int i) {
        ˎ(ˊ(i), true);
    }

    public void removeGroup(int i) {
        int ˋ = ˋ(i);
        if (ˋ >= 0) {
            int size = this.ʼ.size() - ˋ;
            int i2 = 0;
            while (true) {
                int i3 = i2 + 1;
                if (i2 >= size || ((bj) this.ʼ.get(ˋ)).getGroupId() != i) {
                    ˎ(true);
                } else {
                    ˎ(ˋ, false);
                    i2 = i3;
                }
            }
            ˎ(true);
        }
    }

    private void ˎ(int i, boolean z) {
        if (i >= 0 && i < this.ʼ.size()) {
            this.ʼ.remove(i);
            if (z) {
                ˎ(true);
            }
        }
    }

    public void clear() {
        if (this.ˈ != null) {
            ˎ(this.ˈ);
        }
        this.ʼ.clear();
        ˎ(true);
    }

    void ˊ(MenuItem menuItem) {
        int groupId = menuItem.getGroupId();
        int size = this.ʼ.size();
        ॱॱ();
        for (int i = 0; i < size; i++) {
            MenuItem menuItem2 = (bj) this.ʼ.get(i);
            if (menuItem2.getGroupId() == groupId && menuItem2.ʼ() && menuItem2.isCheckable()) {
                menuItem2.ˏ(menuItem2 == menuItem);
            }
        }
        ʼ();
    }

    public void setGroupCheckable(int i, boolean z, boolean z2) {
        int size = this.ʼ.size();
        for (int i2 = 0; i2 < size; i2++) {
            bj bjVar = (bj) this.ʼ.get(i2);
            if (bjVar.getGroupId() == i) {
                bjVar.ॱ(z2);
                bjVar.setCheckable(z);
            }
        }
    }

    public void setGroupVisible(int i, boolean z) {
        int size = this.ʼ.size();
        int i2 = 0;
        boolean z2 = false;
        while (i2 < size) {
            boolean z3;
            bj bjVar = (bj) this.ʼ.get(i2);
            if (bjVar.getGroupId() == i && bjVar.ˋ(z)) {
                z3 = true;
            } else {
                z3 = z2;
            }
            i2++;
            z2 = z3;
        }
        if (z2) {
            ˎ(true);
        }
    }

    public void setGroupEnabled(int i, boolean z) {
        int size = this.ʼ.size();
        for (int i2 = 0; i2 < size; i2++) {
            bj bjVar = (bj) this.ʼ.get(i2);
            if (bjVar.getGroupId() == i) {
                bjVar.setEnabled(z);
            }
        }
    }

    public boolean hasVisibleItems() {
        if (this.ˊˊ) {
            return true;
        }
        int size = size();
        for (int i = 0; i < size; i++) {
            if (((bj) this.ʼ.get(i)).isVisible()) {
                return true;
            }
        }
        return false;
    }

    public MenuItem findItem(int i) {
        int size = size();
        for (int i2 = 0; i2 < size; i2++) {
            bj bjVar = (bj) this.ʼ.get(i2);
            if (bjVar.getItemId() == i) {
                return bjVar;
            }
            if (bjVar.hasSubMenu()) {
                MenuItem findItem = bjVar.getSubMenu().findItem(i);
                if (findItem != null) {
                    return findItem;
                }
            }
        }
        return null;
    }

    public int ˊ(int i) {
        int size = size();
        for (int i2 = 0; i2 < size; i2++) {
            if (((bj) this.ʼ.get(i2)).getItemId() == i) {
                return i2;
            }
        }
        return -1;
    }

    public int ˋ(int i) {
        return ॱ(i, 0);
    }

    public int ॱ(int i, int i2) {
        int size = size();
        if (i2 < 0) {
            i2 = 0;
        }
        for (int i3 = i2; i3 < size; i3++) {
            if (((bj) this.ʼ.get(i3)).getGroupId() == i) {
                return i3;
            }
        }
        return -1;
    }

    public int size() {
        return this.ʼ.size();
    }

    public MenuItem getItem(int i) {
        return (MenuItem) this.ʼ.get(i);
    }

    public boolean isShortcutKey(int i, KeyEvent keyEvent) {
        return ˎ(i, keyEvent) != null;
    }

    public void setQwertyMode(boolean z) {
        this.ॱॱ = z;
        ˎ(false);
    }

    private static int ᐝ(int i) {
        int i2 = (-65536 & i) >> 16;
        if (i2 >= 0 && i2 < ˎ.length) {
            return (ˎ[i2] << 16) | (65535 & i);
        }
        throw new IllegalArgumentException("order does not contain a valid category.");
    }

    boolean ˋ() {
        return this.ॱॱ;
    }

    private void ˋ(boolean z) {
        boolean z2 = true;
        if (!(z && this.ʽ.getConfiguration().keyboard != 1 && ia.ˏ(ViewConfiguration.get(this.ˋ), this.ˋ))) {
            z2 = false;
        }
        this.ʻ = z2;
    }

    public boolean ˏ() {
        return this.ʻ;
    }

    Resources ˎ() {
        return this.ʽ;
    }

    public Context ᐝ() {
        return this.ˋ;
    }

    boolean ॱ(bd bdVar, MenuItem menuItem) {
        return this.ᐝ != null && this.ᐝ.ॱ(bdVar, menuItem);
    }

    public void ʻ() {
        if (this.ᐝ != null) {
            this.ᐝ.ˎ(this);
        }
    }

    private static int ॱ(ArrayList<bj> arrayList, int i) {
        for (int size = arrayList.size() - 1; size >= 0; size--) {
            if (((bj) arrayList.get(size)).ˊ() <= i) {
                return size + 1;
            }
        }
        return 0;
    }

    public boolean performShortcut(int i, KeyEvent keyEvent, int i2) {
        MenuItem ˎ = ˎ(i, keyEvent);
        boolean z = false;
        if (ˎ != null) {
            z = ˎ(ˎ, i2);
        }
        if ((i2 & 2) != 0) {
            ˏ(true);
        }
        return z;
    }

    void ॱ(List<bj> list, int i, KeyEvent keyEvent) {
        boolean ˋ = ˋ();
        int modifiers = keyEvent.getModifiers();
        KeyData keyData = new KeyData();
        if (keyEvent.getKeyData(keyData) || i == 67) {
            int size = this.ʼ.size();
            for (int i2 = 0; i2 < size; i2++) {
                int i3;
                bj bjVar = (bj) this.ʼ.get(i2);
                if (bjVar.hasSubMenu()) {
                    ((bd) bjVar.getSubMenu()).ॱ(list, i, keyEvent);
                }
                char alphabeticShortcut = ˋ ? bjVar.getAlphabeticShortcut() : bjVar.getNumericShortcut();
                if ((modifiers & 69647) == ((ˋ ? bjVar.getAlphabeticModifiers() : bjVar.getNumericModifiers()) & 69647)) {
                    i3 = 1;
                } else {
                    i3 = 0;
                }
                if (!(i3 == 0 || alphabeticShortcut == '\u0000' || ((alphabeticShortcut != keyData.meta[0] && alphabeticShortcut != keyData.meta[2] && (!ˋ || alphabeticShortcut != '\b' || i != 67)) || !bjVar.isEnabled()))) {
                    list.add(bjVar);
                }
            }
        }
    }

    bj ˎ(int i, KeyEvent keyEvent) {
        ArrayList arrayList = this.ʾ;
        arrayList.clear();
        ॱ(arrayList, i, keyEvent);
        if (arrayList.isEmpty()) {
            return null;
        }
        int metaState = keyEvent.getMetaState();
        KeyData keyData = new KeyData();
        keyEvent.getKeyData(keyData);
        int size = arrayList.size();
        if (size == 1) {
            return (bj) arrayList.get(0);
        }
        boolean ˋ = ˋ();
        for (int i2 = 0; i2 < size; i2++) {
            char alphabeticShortcut;
            bj bjVar = (bj) arrayList.get(i2);
            if (ˋ) {
                alphabeticShortcut = bjVar.getAlphabeticShortcut();
            } else {
                alphabeticShortcut = bjVar.getNumericShortcut();
            }
            if (alphabeticShortcut == keyData.meta[0] && (metaState & 2) == 0) {
                return bjVar;
            }
            if (alphabeticShortcut == keyData.meta[2] && (metaState & 2) != 0) {
                return bjVar;
            }
            if (ˋ && alphabeticShortcut == '\b' && i == 67) {
                return bjVar;
            }
        }
        return null;
    }

    public boolean performIdentifierAction(int i, int i2) {
        return ˎ(findItem(i), i2);
    }

    public boolean ˎ(MenuItem menuItem, int i) {
        return ˊ(menuItem, null, i);
    }

    public boolean ˊ(MenuItem menuItem, bn bnVar, int i) {
        bj bjVar = (bj) menuItem;
        if (bjVar == null || !bjVar.isEnabled()) {
            return false;
        }
        boolean z;
        boolean ॱ = bjVar.ॱ();
        hd ˋ = bjVar.ˋ();
        if (ˋ == null || !ˋ.ॱ()) {
            z = false;
        } else {
            z = true;
        }
        boolean expandActionView;
        if (bjVar.ˊॱ()) {
            expandActionView = bjVar.expandActionView() | ॱ;
            if (!expandActionView) {
                return expandActionView;
            }
            ˏ(true);
            return expandActionView;
        } else if (bjVar.hasSubMenu() || z) {
            if ((i & 4) == 0) {
                ˏ(false);
            }
            if (!bjVar.hasSubMenu()) {
                bjVar.ˊ(new bv(ᐝ(), this, bjVar));
            }
            bv bvVar = (bv) bjVar.getSubMenu();
            if (z) {
                ˋ.ˎ((SubMenu) bvVar);
            }
            expandActionView = ˎ(bvVar, bnVar) | ॱ;
            if (expandActionView) {
                return expandActionView;
            }
            ˏ(true);
            return expandActionView;
        } else {
            if ((i & 1) == 0) {
                ˏ(true);
            }
            return ॱ;
        }
    }

    public final void ˏ(boolean z) {
        if (!this.ʼॱ) {
            this.ʼॱ = true;
            Iterator it = this.ʽॱ.iterator();
            while (it.hasNext()) {
                WeakReference weakReference = (WeakReference) it.next();
                bn bnVar = (bn) weakReference.get();
                if (bnVar == null) {
                    this.ʽॱ.remove(weakReference);
                } else {
                    bnVar.ˏ(this, z);
                }
            }
            this.ʼॱ = false;
        }
    }

    public void close() {
        ˏ(true);
    }

    public void ˎ(boolean z) {
        if (this.ॱˋ) {
            this.ॱˎ = true;
            if (z) {
                this.ʻॱ = true;
                return;
            }
            return;
        }
        if (z) {
            this.ˋॱ = true;
            this.ॱˊ = true;
        }
        ॱ(z);
    }

    public void ॱॱ() {
        if (!this.ॱˋ) {
            this.ॱˋ = true;
            this.ॱˎ = false;
            this.ʻॱ = false;
        }
    }

    public void ʼ() {
        this.ॱˋ = false;
        if (this.ॱˎ) {
            this.ॱˎ = false;
            ˎ(this.ʻॱ);
        }
    }

    void ˏ(bj bjVar) {
        this.ˋॱ = true;
        ˎ(true);
    }

    void ˊ(bj bjVar) {
        this.ॱˊ = true;
        ˎ(true);
    }

    @NonNull
    public ArrayList<bj> ʽ() {
        if (!this.ˋॱ) {
            return this.ˊॱ;
        }
        this.ˊॱ.clear();
        int size = this.ʼ.size();
        for (int i = 0; i < size; i++) {
            bj bjVar = (bj) this.ʼ.get(i);
            if (bjVar.isVisible()) {
                this.ˊॱ.add(bjVar);
            }
        }
        this.ˋॱ = false;
        this.ॱˊ = true;
        return this.ˊॱ;
    }

    public void ˊॱ() {
        ArrayList ʽ = ʽ();
        if (this.ॱˊ) {
            Iterator it = this.ʽॱ.iterator();
            int i = 0;
            while (it.hasNext()) {
                int i2;
                WeakReference weakReference = (WeakReference) it.next();
                bn bnVar = (bn) weakReference.get();
                if (bnVar == null) {
                    this.ʽॱ.remove(weakReference);
                    i2 = i;
                } else {
                    i2 = bnVar.ˏ() | i;
                }
                i = i2;
            }
            if (i != 0) {
                this.ˏॱ.clear();
                this.ͺ.clear();
                i = ʽ.size();
                for (int i3 = 0; i3 < i; i3++) {
                    bj bjVar = (bj) ʽ.get(i3);
                    if (bjVar.ʻ()) {
                        this.ˏॱ.add(bjVar);
                    } else {
                        this.ͺ.add(bjVar);
                    }
                }
            } else {
                this.ˏॱ.clear();
                this.ͺ.clear();
                this.ͺ.addAll(ʽ());
            }
            this.ॱˊ = false;
        }
    }

    public ArrayList<bj> ͺ() {
        ˊॱ();
        return this.ˏॱ;
    }

    public ArrayList<bj> ॱˊ() {
        ˊॱ();
        return this.ͺ;
    }

    public void clearHeader() {
        this.ˊ = null;
        this.ॱ = null;
        this.ˏ = null;
        ˎ(false);
    }

    private void ॱ(int i, CharSequence charSequence, int i2, Drawable drawable, View view) {
        Resources ˎ = ˎ();
        if (view != null) {
            this.ˏ = view;
            this.ॱ = null;
            this.ˊ = null;
        } else {
            if (i > 0) {
                this.ॱ = ˎ.getText(i);
            } else if (charSequence != null) {
                this.ॱ = charSequence;
            }
            if (i2 > 0) {
                this.ˊ = fo.ˊ(ᐝ(), i2);
            } else if (drawable != null) {
                this.ˊ = drawable;
            }
            this.ˏ = null;
        }
        ˎ(false);
    }

    protected bd ˋ(CharSequence charSequence) {
        ॱ(0, charSequence, 0, null, null);
        return this;
    }

    protected bd ˎ(int i) {
        ॱ(i, null, 0, null, null);
        return this;
    }

    protected bd ॱ(Drawable drawable) {
        ॱ(0, null, 0, drawable, null);
        return this;
    }

    protected bd ˏ(int i) {
        ॱ(0, null, i, null, null);
        return this;
    }

    protected bd ॱ(View view) {
        ॱ(0, null, 0, null, view);
        return this;
    }

    public CharSequence ˏॱ() {
        return this.ॱ;
    }

    public Drawable ˋॱ() {
        return this.ˊ;
    }

    public View ॱᐝ() {
        return this.ˏ;
    }

    public bd ॱˋ() {
        return this;
    }

    boolean ʻॱ() {
        return this.ʿ;
    }

    public boolean ˋ(bj bjVar) {
        boolean z = false;
        if (!this.ʽॱ.isEmpty()) {
            ॱॱ();
            Iterator it = this.ʽॱ.iterator();
            boolean z2 = false;
            while (it.hasNext()) {
                WeakReference weakReference = (WeakReference) it.next();
                bn bnVar = (bn) weakReference.get();
                if (bnVar == null) {
                    this.ʽॱ.remove(weakReference);
                    z = z2;
                } else {
                    z = bnVar.ˏ(this, bjVar);
                    if (z) {
                        break;
                    }
                }
                z2 = z;
            }
            z = z2;
            ʼ();
            if (z) {
                this.ˈ = bjVar;
            }
        }
        return z;
    }

    public boolean ˎ(bj bjVar) {
        boolean z = false;
        if (!this.ʽॱ.isEmpty() && this.ˈ == bjVar) {
            ॱॱ();
            Iterator it = this.ʽॱ.iterator();
            boolean z2 = false;
            while (it.hasNext()) {
                WeakReference weakReference = (WeakReference) it.next();
                bn bnVar = (bn) weakReference.get();
                if (bnVar == null) {
                    this.ʽॱ.remove(weakReference);
                    z = z2;
                } else {
                    z = bnVar.ˎ(this, bjVar);
                    if (z) {
                        break;
                    }
                }
                z2 = z;
            }
            z = z2;
            ʼ();
            if (z) {
                this.ˈ = null;
            }
        }
        return z;
    }

    public bj ॱˎ() {
        return this.ˈ;
    }

    public void ˊ(boolean z) {
        this.ˊˊ = z;
    }
}
